package com.apple.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;
import java.net.Socket;

@Slf4j
@Configuration
public class SocketConfig {
    //服务端ip
    //@Value("${socket.server.ip}")
    //private String ip;

    //服务端端口
    //@Value("${socket.server.port}")
    //private int port;

    @Bean
    public Socket client(){
        Socket socket = null;
        try {
            socket = new Socket("localhost",8081);
        } catch (IOException e) {
            log.error("客户端socket连接创建失败");
            throw new RuntimeException(e);
        }
        log.info("客户端socket连接创建成功");
        return socket;
    }
}
